using Microsoft.DirectX;
using TgcViewer.Utils.TgcGeometry;
using System.Drawing;

namespace AlumnoEjemplos.SEGUROLA_Y_HABANA_4310
{
    public class Misil
    {
        public TgcBoundingSphere renderObject;

        public float Angle;

        public Vector3 direction;

        public float speed = 100;

        public Misil(Vector3 position, Vector3 direction)
        {
            TgcBoundingSphere boundingSphere = new TgcBoundingSphere();
            boundingSphere.setRenderColor(Color.Red);
            boundingSphere.AlphaBlendEnable = true;
            boundingSphere.setValues(position, 3f);
            this.renderObject = boundingSphere;
            var substract = direction - position;
            //substract.TransformNormal(Matrix.Identity);
            this.direction = substract;
        }

        public void Update(float ElapsedTime)
        {
            Vector3 movement = new Vector3();
            movement.X = speed * ElapsedTime * this.direction.X;
            movement.Y = speed * ElapsedTime * this.direction.Y;
            movement.Z = speed * ElapsedTime * this.direction.Z;
            this.renderObject.moveCenter(movement);  
        }

        public void Render()
        {
            this.renderObject.render();
        }

    }
}
